<?php
    include('./config.php');
    include('./request.php');
    $user_id = $result->user_id;
    $user_name = $result->user_name;
    $user_password = $result->user_password;
    $user_phone = $result->user_phone;
    $user_email = $result->user_email;
    try{
        $pdo = new PDO($dsn,$user,$pass);
        $pdo->beginTransaction();
        $sql = "update user set user_name = '".$user_name."',user_password='".$user_password."',user_phone='".$user_phone."',user_email='".$user_email."' where user_id = ".$user_id;
        $res = $pdo->prepare($sql);
        $res->execute();
        if($res){
            echo "ok";
            $pdo->commit();
        }else{
            echo "error";
            $pdo->rollBack();
        }
    }catch(PDOException $e){
        $pdo->rollBack();
        echo "error";
    }
?>